﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace QtingvisionAIService
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main(string[] args)
        {
#if DEBUG
            // 调试模式下直接运行服务
            var service = new QtingvisionAIService();
            service.Test("PROCESS|D:/标定数据/mytest/7.jpg|D:/标定数据/mytest|0.1|0");
            //service.GetType()
            //    .GetMethod("StartNamedPipeServer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
            //    .Invoke(service, new object[] { "PROCESS|D:/标定数据/mytest/7.jpg|D:/标定数据/mytest|0.1|0" });

            //Console.WriteLine("Service running in debug mode. Press any key to stop...");
            //Console.ReadKey();

            //service.GetType()
            //    .GetMethod("OnStop", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
            //    .Invoke(service, null);
#else
               // 发布模式下作为服务运行
               ServiceBase[] ServicesToRun;
               ServicesToRun = new ServiceBase[]
               {
                   new QtingvisionAIService()
               };
               ServiceBase.Run(ServicesToRun);
#endif

            //ServiceBase[] ServicesToRun;
            //ServicesToRun = new ServiceBase[]
            //{
            //    new QtingvisionAIService()
            //};
            //ServiceBase.Run(ServicesToRun);
        }
    }
}
